<template>
	<div class="view_page weizhi">
		<el-card class="box-card" v-loading="loading" element-loading-text="拼命加载中"
			element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
			<!--卡片头部-->
			<div slot="header" class="clearfix">
				<!--左侧-->
				<div class="left">
					<div class="back-page">
						<div class="add-back" @click="back">
							<i class="fa fa-arrow-left" aria-hidden="true"></i>
							<span v-if="this.addtype == 'add'">新增地区高亮坐标</span>
							<span v-else-if="this.addtype == 'update'">修改地区高亮坐标</span>
							<span v-else>查看地区高亮坐标</span>
						</div>
					</div>
				</div>
				<div class="right">
					<el-button type="primary" v-if="addtype!='query'" @click="save()">保存
					</el-button>
					<!-- <el-button type="primary" @click="update()" v-if="addtype == 'update'"
            >保存</el-button
          > -->
				</div>
			</div>
			<!--卡片内容-->
			<div class="card-centont">
				<el-form :model="liveData" label-width="120px" @submit.native.prevent>
					<el-form-item label="类型" :required="true">
						<el-select v-model="liveData.has_engine" @change="changeType" :disabled="addtype=='query'">
							<el-option v-for="item in engineeringTypeList" :key="item.id" :value="item.val"
								:label="item.name"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="地区" v-if="liveData.has_engine==1" :required="true">
						<el-cascader class="cascader" v-model="selelected2" :options="area" :props="props2" clearable
							:popper-class="'hide'" ref="areaRef" :disabled="addtype=='query'" @change="changeArea">
						</el-cascader>
					</el-form-item>
					<el-form-item label="工程" v-if="liveData.has_engine==0">
						<el-cascader class="cascader" v-model="selelected" :options="options" :props="props" clearable
							:popper-class="'hide'" ref="cascade" :disabled="addtype=='query'" @change="changeCity">
						</el-cascader>
					</el-form-item>
					<el-form-item label="posX">
						<el-input v-model="liveData.posX" @input="poxregular('posX')" :disabled="addtype=='query'">
						</el-input>
					</el-form-item>
					<el-form-item label="posY">
						<el-input v-model="liveData.posY" @input="poxregular('posY')" :disabled="addtype=='query'">
						</el-input>
					</el-form-item>
					<el-form-item label="posZ">
						<el-input v-model="liveData.posZ" @input="poxregular('posZ')" :disabled="addtype=='query'">
						</el-input>
					</el-form-item>
					<el-form-item label="outlineColor">
						<el-input v-model="liveData.outlineColor" :disabled="addtype=='query'"></el-input>
					</el-form-item>
					<el-form-item label="inColor">
						<el-input v-model="liveData.inColor" :disabled="addtype=='query'"></el-input>
					</el-form-item>
					<el-form-item label="clickModelPath">
						<el-input v-model="liveData.clickModelPath" :disabled="addtype=='query'"></el-input>
					</el-form-item>
					<el-form-item label="showModelPath">
						<el-input v-model="liveData.showModelPath" :disabled="addtype=='query'"></el-input>
					</el-form-item>
					<el-form-item label="remark">
						<el-input v-model="liveData.remark" :disabled="addtype=='query'"></el-input>
					</el-form-item>
					<el-form-item label="formType">
						<el-input v-model="liveData.formType" :disabled="addtype=='query'"></el-input>
					</el-form-item>

					<!-- <el-form-item label="cameraConfig:" > -->
					<!-- <el-input v-model="liveData.formType"></el-input> -->
					<!-- </el-form-item> -->
					<div class="" style="margin-bottom: 20px;font-weight: bold;">
						cameraConfig:
					</div>
					<el-row :gutter="16" class="form-input-row">
						<div>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="focusingDistance">
										<el-input v-model="liveData.cameraConfig.focusingDistance"
											@input="regular('cameraConfig','focusingDistance')"
											:disabled="addtype=='query'"></el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="focusingX">
										<el-input v-model="liveData.cameraConfig.focusingX"
											@input="regular('cameraConfig','focusingX')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="focusingY">
										<el-input v-model="liveData.cameraConfig.focusingY"
											@input="regular('cameraConfig','focusingY')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posX">
										<el-input v-model="liveData.cameraConfig.posX"
											@input="regular('cameraConfig','posX')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posY">
										<el-input v-model="liveData.cameraConfig.posY"
											@input="regular('cameraConfig','posY')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posZ">
										<el-input v-model="liveData.cameraConfig.posZ"
											@input="regular('cameraConfig','posZ')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
						</div>
					</el-row>


					<div class="" style="margin-bottom: 20px;font-weight: bold;">
						topCameraConfig:
					</div>
					<el-row :gutter="16" class="form-input-row">
						<div>


							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posX">
										<el-input v-model="liveData.topCameraConfig.posX"
											@input="regular('topCameraConfig','posX')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posY">
										<el-input v-model="liveData.topCameraConfig.posY"
											@input="regular('topCameraConfig','posY')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posZ">
										<el-input v-model="liveData.topCameraConfig.posZ"
											@input="regular('topCameraConfig','posZ')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
						</div>
					</el-row>
					<div class="" style="margin-bottom: 20px;font-weight: bold;">
						roamingConfig:
					</div>
					<el-row :gutter="16" class="form-input-row">
						<div>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="isRoaming" :required="true">
										<el-select v-model="liveData.roamingConfig.isRoaming"
											:disabled="addtype=='query'">
											<el-option v-for="item in determineList" :key="item.id" :value="item.id"
												:label="item.name"></el-option>
										</el-select>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posX">
										<el-input v-model="liveData.roamingConfig.posX"
											@input="regular('roamingConfig','posX')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posY">
										<el-input v-model="liveData.roamingConfig.posY"
											@input="regular('roamingConfig','posY')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>

							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="posZ">
										<el-input v-model="liveData.roamingConfig.posZ"
											@input="regular('roamingConfig','posZ')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="rotX">
										<el-input v-model="liveData.roamingConfig.rotX"
											@input="regular('roamingConfig','rotX')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="rotY">
										<el-input v-model="liveData.roamingConfig.rotY"
											@input="regular('roamingConfig','rotY')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
							<el-col :span="8" class="form-input-col">
								<div class="grid-content">
									<el-form-item label="rotZ">
										<el-input v-model="liveData.roamingConfig.rotZ"
											@input="regular('roamingConfig','rotZ')" :disabled="addtype=='query'">
										</el-input>
									</el-form-item>

								</div>
							</el-col>
						</div>
					</el-row>


					<div class="" style="margin-bottom: 20px;font-weight: bold;">
						guideConfig:
					</div>
					<el-row :gutter="16" class="form-input-row">
						<el-col :span="8" class="form-input-col">
							<div class="grid-content">
								<el-form-item label="isGuide" :required="true">
									<el-select v-model="liveData.guideConfig.isGuide" :disabled="addtype=='query'">
										<el-option v-for="item in determineList" :key="item.id" :value="item.id"
											:label="item.name"></el-option>
									</el-select>
								</el-form-item>
							</div>
						</el-col>
						<el-col :span="8" class="form-input-col">
							<div class="grid-content">
								<el-form-item label="guideLinePointInfo" label-width="140px">
									<el-input v-model="liveData.guideConfig.guideLinePointInfo"
										:disabled="addtype=='query'">
									</el-input>
								</el-form-item>
							</div>
						</el-col>
						<el-col :span="8" class="form-input-col">
							<div class="grid-content">
								<el-form-item label="lookLinePointInfo" label-width="140px">
									<el-input v-model="liveData.guideConfig.lookLinePointInfo"
										:disabled="addtype=='query'">
									</el-input>
								</el-form-item>
							</div>
						</el-col>
					</el-row>

					<div class="" style="margin-bottom: 20px;font-weight: bold;">
						meshPoint:
					</div>
					<el-row :gutter="16" class="form-input-row">
						<div>
							<el-col :span="8" class="form-input-col" v-if="!(addtype=='query')">
								<div class="grid-content">
									<el-form-item label="meshPoint">
										<el-upload class="upload-demo" ref="uploadYml" :action="uploadUrl"
											:on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList"
											:data="uploadData" name="kml_file" :before-upload="beforeAvatarUpload"
											:on-success="handleAvatarSuccess" :on-error="handleAvatarError"
											:on-exceed="numberExceeded" :auto-upload="false"
											:on-change="changeUploadFile" accept=".kml" :limit="1"
											:disabled="addtype=='query'">
											<el-button slot="trigger" size="small" type="primary"
												:disabled="addtype=='query'">
												选取kml文件
											</el-button>
										</el-upload>
									</el-form-item>
								</div>
							</el-col>
							<el-table :data="fileList" style="width: 100%" v-if="addtype=='query'">
								<el-table-column prop="name" label="名称" align="center" min-width="100">
								</el-table-column>
								<el-table-column fixed="right" label="操作" min-width="230" align="center">
									<template slot-scope="scope">
										<div style="display: flex;align-items: center;flex-wrap: wrap; ">

											<el-button type="success" size="small" @click="dowload(scope.row.url)">
												下载
											</el-button>
										</div>
									</template>
								</el-table-column>
							</el-table>
						</div>
					</el-row>
				</el-form>
			</div>
		</el-card>

	</div>
</template>

<script>
	import axios from "axios";
	import qs from "qs";
	import {
		Message
	} from "element-ui";

	export default {
		name: "liveAdd",
		components: {},
		data() {
			return {
				loading: false,
				liveData: {
					has_engine: 0, // 0工程 1地方
					// value: '',
					engine1: '', // 大工程id
					engine2: '', // 小工程id
					engine_name: '', // 小工程名称
					posX: '',
					posY: '',
					posZ: '',
					outlineColor: '',
					inColor: '',
					clickModelPath:'',
					showModelPath:'',
					remark:'',
					formType: 'mesh',
					cameraConfig: {
						focusingDistance: '',
						focusingX: '',
						focusingY: '',
						posX: '',
						posY: '',
						posZ: '',
					},
					topCameraConfig: {
						posX: '',
						posY: '',
						posZ: ''
					},
					roamingConfig: {
						isRoaming: false,
						posX: '',
						posY: '',
						posZ: '',
						rotX: '',
						rotY: '',
						rotZ: '',
					},
					guideConfig: {
						isGuide: false,
						guideLinePointInfo: '',
						lookLinePointInfo: ''
					}
				},
				addtype: '',
				engineeringTypeList: [{
						id: 'River',
						val: 1,
						name: '地区'
					},
					{
						id: 'Engineer',
						val: 0,
						name: '工程'
					}
				],
				determineList: [{
						id: false,
						name: '否'
					},
					{
						id: true,
						name: '是'
					},
				],
				// uploadUrl: this.$apis.getUploadUrl() + "/file/upload", //上传地址
				uploadUrl: this.$apis.getUploadYmlUrl(),
				uploadData: {
					// type: 1 //没用
				},
				isHasUploadFile: false,
				fileList: [],
				allfileList: [],
				file_id: '',
				area: [],
				options: [],
				selelected: [],
				selelected2: [],
				props: {
					// multiple: true,
					expandTrigger: "click"
				},
				props2: {
					// multiple: true,
					expandTrigger: "click"
				},

			};
		},
		// watch: {
		//   liveData: {
		//     handler(val, oldVal) {
		//       this.updateData = val || {};
		//     }, immediate: true, deep: true,
		//   },
		// },
		created() {
			var _this = this;
			_this.getoptionsData(); //选择工程级联列表
			_this.getareaData(); //选择地区级联列表
			this.addtype = this.$route.query.type;
			if (this.$route.query.type == 'add') {
				this.uploadUrl = this.$apis.getUploadYmlUrl();
			} else {
				this.uploadUrl = this.$apis.getUpdateUploadYmlUrl();
				var getdata = this.$route.query.data;
				this.liveData = Object.assign(this.liveData, getdata);
				this.$nextTick(() => {
					let ids = [];
					ids.push(this.liveData.engine1);
					ids.push(this.liveData.engine2);
					if (this.liveData.has_engine == 0) {
						this.selelected = ids;
					} else {
						this.selelected2 = ids;
					}
					console.log(this.selelected2)
				});
				if (getdata.file_url != '' && getdata.file_url != null && getdata.file_url != undefined) {
					this.fileList.push({
						id: getdata.file_id,
						name: getdata.file_name,
						url: getdata.file_url,
					})
				}
				console.log(this.fileList)

				// let proArr = [], riverArr = [];
				// for (let i = 0; i < this.liveData.json_pro.length; i++) {
				//   let tp = this.liveData.json_pro[i];
				//   proArr.push([tp.pro_type, tp.pro_id]);
				// }
				// for (let i = 0; i < this.liveData.json_rivers.length; i++) {
				//   let tp = this.liveData.json_rivers[i];
				//   riverArr.push([tp.river_type, tp.river_id]);
				// }
				// this.selelected = proArr;
				// this.selelected2 = riverArr;
			}
		},

		methods: {
			initData() {
				this.liveData = {};
			},
			// changeType() {
			//   this.liveData.value = ''
			//   this.liveData.engineerId1 = ''
			//   this.liveData.engineerId2 = ''
			// },
			// 选择地区级联列表
			getareaData() {
				var _this = this;
				_this.$apis.unitywebpc_address_list().then(res => {
					if (res.result == 0) {
						_this.area = res.data;
					}
				});
			},
			// 选择工程级联列表
			getoptionsData() {
				var _this = this;
				_this.$apis.unitywebpc_engine_list().then(res => {
					if (res.result == 0) {
						_this.options = res.data;
					}
				});
			},
			changeType() {
				this.liveData.engine1 = '';
				this.liveData.engine2 = '';
				this.liveData.engine_name = '';
			},
			// 工程级联选择
			changeCity(items) {
				if (this.selelected.length > 1) {
					this.liveData.engine1 = this.selelected[0];
					this.liveData.engine2 = this.selelected[1];
					let itemArr = [];
					this.$refs["cascade"].getCheckedNodes(items).map(item => {
						itemArr.push({
							pro_type: item.pathNodes[0].value,
							pro_id: item.pathNodes[1].value,
							// pro_id: item.value,
							name: item.pathLabels[0],
							pro_name: item.pathLabels[1]
						});
					});
					this.liveData.engine_name = itemArr[0].pro_name;
				}

				// console.log(this.selelected)
				// console.log(items, this.$refs["cascade"].currentLabels);
				// console.log(this.$refs["cascade"].getCheckedNodes(items));
				// let itemArr = [];
				// this.$refs["cascade"].getCheckedNodes(items).map(item => {
				//   itemArr.push({
				//     pro_type: item.pathNodes[0].value,
				//     pro_id: item.pathNodes[1].value,
				//     // pro_id: item.value,
				//     name: item.pathLabels[0],
				//     pro_name: item.pathLabels[1]
				//   });
				// });
				// // console.log("itemArr:", JSON.stringify(itemArr));
				// // this.itemArr = itemArr;
				// this.liveData.json_pro = itemArr;
			},
			// 地区级联选择
			changeArea(items) {
				if (this.selelected2.length > 1) {
					this.liveData.engine1 = this.selelected2[0];
					this.liveData.engine2 = this.selelected2[1];
					let itemArr2 = [];
					this.$refs["areaRef"].getCheckedNodes(items).map(item => {
						itemArr2.push({
							river_type: item.pathNodes[0].value,
							river_id: item.pathNodes[1].value,
							name: item.pathLabels[0],
							river_name: item.pathLabels[1]
						});
					});
					this.liveData.engine_name = itemArr2[0].river_name;
				}

				// // console.log(this.selelected2)
				// let itemArr2 = [];
				// this.$refs["areaRef"].getCheckedNodes(items).map(item => {
				//   itemArr2.push({
				//     river_type: item.pathNodes[0].value,
				//     river_id: item.pathNodes[1].value,
				//     name: item.pathLabels[0],
				//     river_name: item.pathLabels[1]
				//   });
				// });
				// // console.log("itemArr2:", JSON.stringify(itemArr2));
				// // this.itemArr2 = itemArr2;
				// this.liveData.json_rivers = itemArr2;
			},

			//文件列表移除文件时的钩子
			handleRemove(file, fileList) {
				this.fileList = fileList
				this.file_id = ''
				this.isHasUploadFile = false;
				// console.log('remove isHasUploadFile',this.isHasUploadFile)
			},

			//点击文件列表中已上传的文件时的钩子
			handlePreview(file) {
				console.log(file);
			},

			//文件上传成功的钩子
			handleAvatarSuccess(res, file, fileList) {
				if (res.result == 0) {
					Message.success((this.addtype == 'add' ? '添加' : '修改') + '成功')
					this.back()
				}
				// this.fileList = fileList
				// this.file_id = res.data.id;

				// this.imageUrl = URL.createObjectURL(file.raw)
			},

			//文件上传失败时的钩子
			handleAvatarError(err, file) {
				Message.error("文件上传失败，请稍后再试");
			},

			//文件超出一个
			numberExceeded() {
				// Message.warning("只能上传一张图片");
			},

			//上传文件之前的钩子
			beforeAvatarUpload(file) {
				this.isHasUploadFile = true;
				// console.log('上传文件之前的钩子===============================')
				return true;
				// 	var typeList = ["image/jpeg", "image/png", "image/jpg"];
				// 	// const isJPG = file.type === 'image/jpeg'
				// 	const isJPG = typeList.includes(file.type);
				// 	const isLt2M = file.size / 1024 / 1024 < 10;

				// 	if (!isJPG) {
				// 		this.$message.warning("上传图片只能是 JPG或者PNG 格式!");
				// 	}
				// 	if (!isLt2M) {
				// 		this.$message.warning("上传文件大小不能超过 10MB!");
				// 	}
				// 	return isJPG && isLt2M;
			},
			changeUploadFile(file, fileList) {
				// console.log(file,fileList)
				if (fileList && fileList.length > 0) {
					this.isHasUploadFile = true;
				}
				// console.log('is has upload file========',this.isHasUploadFile)
			},

			save() {
				let datas = JSON.parse(JSON.stringify(this.liveData))
				// if (datas.json_pro == '' || datas.json_pro == undefined
				//   || datas.json_pro == null || datas.json_rivers == ''
				//   || datas.json_rivers == undefined || datas.json_rivers == null
				//   || (datas.json_pro && datas.json_pro.length == 0 && datas.json_rivers
				//     && datas.json_rivers.length == 0)) {
				//   Message.warning('地区/工程不能为空')
				//   return
				// }
				console.log(datas)
				if ((this.liveData.engine1 == '' || this.liveData.engine1 == null || this.liveData.engine1 == undefined) &&
					(this.engine2 == '' || this.engine2 == null || this.engine2 == undefined) && (this.liveData
						.engine_name == '' || this.liveData.engine_name == null || this.liveData.engine_name == mull)
				) {
					Message.warning('请选择一个工程/地区')
					return;
				}
				// if (datas.posX == '' || datas.posX == undefined || datas.posX == null) {
				// 	Message.warning('posX不能为空')
				// 	return
				// }
				// if (datas.posY == '' || datas.posY == undefined || datas.posY == null) {
				// 	Message.warning('posY不能为空')
				// 	return
				// }
				// if (datas.posZ == '' || datas.posZ == undefined || datas.posZ == null) {
				// 	Message.warning('posZ不能为空')
				// 	return
				// }
				// if (datas.outlineColor == '' || datas.outlineColor == undefined ||
				// 	datas.outlineColor == null) {
				// 	Message.warning('outlineColor不能为空')
				// 	return
				// }
				// if (datas.inColor == '' || datas.inColor == undefined || datas.inColor ==
				// 	null) {
				// 	Message.warning('inColor不能为空')
				// 	return
				// }
				// if (datas.formType == '' || datas.formType == undefined ||
				// 	datas.formType == null) {
				// 	Message.warning('formType不能为空')
				// 	return
				// }
				// if (datas.cameraConfig.focusingDistance == '' ||
				// 	datas.cameraConfig.focusingDistance == undefined || datas
				// 	.cameraConfig.focusingDistance == null) {
				// 	Message.warning('cameraConfig.focusingDistance不能为空')
				// 	return
				// }
				// if (datas.cameraConfig.focusingX == '' || datas.cameraConfig.focusingX ==
				// 	undefined || datas.cameraConfig
				// 	.focusingX == null) {
				// 	Message.warning('cameraConfig.focusingX不能为空')
				// 	return
				// }
				// if (datas.cameraConfig.focusingY == '' || datas.cameraConfig.focusingY ==
				// 	undefined || datas.cameraConfig
				// 	.focusingY == null) {
				// 	Message.warning('cameraConfig.focusingY不能为空')
				// 	return
				// }
				// if (datas.cameraConfig.posX == '' || datas.cameraConfig.posX ==
				// 	undefined || datas.cameraConfig.posX ==
				// 	null) {
				// 	Message.warning('cameraConfig.posX不能为空')
				// 	return
				// }
				// if (datas.cameraConfig.posY == '' || datas.cameraConfig.posY ==
				// 	undefined || datas.cameraConfig.posY ==
				// 	null) {
				// 	Message.warning('cameraConfig.posY不能为空')
				// 	return
				// }
				// if (datas.cameraConfig.posZ == '' || datas.cameraConfig.posZ ==
				// 	undefined || datas.cameraConfig.posZ ==
				// 	null) {
				// 	Message.warning('cameraConfig.posZ不能为空')
				// 	return
				// }

				// if (datas.topCameraConfig.posX == '' || datas.topCameraConfig.posX ==
				// 	undefined || datas.topCameraConfig
				// 	.posX == null) {
				// 	Message.warning('topCameraConfig.posX不能为空')
				// 	return
				// }
				// if (datas.topCameraConfig.posY == '' || datas.topCameraConfig.posY ==
				// 	undefined || datas.topCameraConfig
				// 	.posY == null) {
				// 	Message.warning('topCameraConfig.posY不能为空')
				// 	return
				// }
				// if (datas.topCameraConfig.posZ == '' || datas.topCameraConfig.posZ ==
				// 	undefined || datas.topCameraConfig.posZ == null) {
				// 	Message.warning('topCameraConfig.posZ不能为空')
				// 	return
				// }

				// if (datas.roamingConfig.posX == '' || datas.roamingConfig.posX ==
				// 	undefined || datas.roamingConfig.posX == null) {
				// 	Message.warning('roamingConfig.posX不能为空')
				// 	return
				// }
				// if (datas.roamingConfig.posY == '' || datas.roamingConfig.posY ==
				// 	undefined || datas.roamingConfig.posY == null) {
				// 	Message.warning('roamingConfig.posY不能为空')
				// 	return
				// }
				// if (datas.roamingConfig.posZ == '' || datas.roamingConfig.posZ ==
				// 	undefined || datas.roamingConfig.posZ == null) {
				// 	Message.warning('roamingConfig.posZ不能为空')
				// 	return
				// }
				// if (datas.roamingConfig.rotX == '' || datas.roamingConfig.rotX ==
				// 	undefined || datas.roamingConfig.rotX == null) {
				// 	Message.warning('roamingConfig.rotX')
				// 	return
				// }
				// if (datas.roamingConfig.rotY == '' || datas.roamingConfig.rotY ==
				// 	undefined || datas.roamingConfig.rotY == null) {
				// 	Message.warning('roamingConfig.rotY不能为空')
				// 	return
				// }
				// if (datas.roamingConfig.rotZ == '' || datas.roamingConfig.rotZ ==
				// 	undefined || datas.roamingConfig.rotZ == null) {
				// 	Message.warning('roamingConfig.rotZ不能为空')
				// 	return
				// }
				// if (datas.roamingConfig.isRoaming == '' || datas.roamingConfig.isRoaming ==
				// 	undefined || datas.roamingConfig.isRoaming == null) {
				// 	Message.warning('roamingConfig.isRoaming不能为空')
				// 	return
				// }
				// if (datas.guideConfig.isGuide == '' || datas.guideConfig.isGuide ==
				// 	undefined || datas.guideConfig.isGuide == null) {
				// 	Message.warning('guideConfig.isGuide不能为空')
				// 	return
				// }

				datas.cameraConfig = JSON.stringify(datas.cameraConfig);
				datas.topCameraConfig = JSON.stringify(datas.topCameraConfig);
				datas.roamingConfig = JSON.stringify(datas.roamingConfig);
				datas.guideConfig = JSON.stringify(datas.guideConfig);
				datas.json_pro = JSON.stringify(datas.json_pro);
				datas.json_rivers = JSON.stringify(datas.json_rivers);
				// datas.topCameraConfig = JSON.stringify(datas.topCameraConfig);
				this.uploadData = datas;

				console.log(this.uploadData);
				if (this.isHasUploadFile) {
					setTimeout(() => {
						this.$refs.uploadYml.submit();
					}, 40);
				} else {
					if (this.addtype == 'add') {
						this.$apis.u_hightlight_add(datas).then(res => {
							if (res.result == 0) {
								Message.success('添加成功')
								this.back()
							}
						});
					} else {
						// datas.id = _this.$route.query.data.id;
						this.$apis.u_hightlight_update(datas).then(res => {
							if (res.result == 0) {
								Message.success('修改成功')
								this.back()
							}
						})
					}
				}

			},

			back() {
				this.$router.back();
			},

			regular(item, type) {
				if (type) {
					let checkPlan = this.liveData[item][type]
					checkPlan = checkPlan.replace(/[^\d.]/g, "").replace().replace(
						/\.{2,}/g, "").replace(/^\./g,
						"") // 保证第一个为数字而不是. // 只保留第一个. 清除多余的

					if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
						// 以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
						checkPlan = parseFloat(checkPlan) + "";
					} else if (checkPlan.indexOf(".") >= 0) {
						if (checkPlan.indexOf(".") != checkPlan.lastIndexOf(".")) {
							checkPlan = checkPlan.slice(0, checkPlan.lastIndexOf(".")) +
								checkPlan.slice(checkPlan
									.lastIndexOf(".") + 1, checkPlan.length)

						}
					}
					this.liveData[item][type] = checkPlan
				} else {
					let checkPlan = this.liveData[item]
					checkPlan = checkPlan.replace(/[^\d.]/g, "").replace().replace(
						/\.{2,}/g, "").replace(/^\./g,
						"") // 保证第一个为数字而不是. // 只保留第一个. 清除多余的

					if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
						// 以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
						checkPlan = parseFloat(checkPlan) + "";
					} else if (checkPlan.indexOf(".") >= 0) {
						if (checkPlan.indexOf(".") != checkPlan.lastIndexOf(".")) {
							checkPlan = checkPlan.slice(0, checkPlan.lastIndexOf(".")) +
								checkPlan.slice(checkPlan
									.lastIndexOf(".") + 1, checkPlan.length)

						}
					}
					this.liveData[item] = checkPlan
				}

				// if(checkPlan>1){
				// 	checkPlan = checkPlan
				// 		.replace(/^0*/g, "") // 清除数字之前的0
				// }else{
				// 	checkPlan = checkPlan
				// 		.replace(/^0*/g, "0") // 清除数字之前的0
				// }
				//  // if(yy.indexOf('.')!=yy.lastIndexOf('.')){
				//  //  var cc = yy.lastIndexOf('.')
				//  //   yy.splice(cc,1)
				//  //    console.log(cc,yy)
				//  // }

			},
			poxregular(item, type) {
				if (type) {
				} else {
					let checkPlan = this.liveData[item]
					checkPlan = checkPlan.replace(/[^\d.-]/g, "").replace().replace(
						/\.{2,}/g, "").replace(/^\./g,
						"") // 保证第一个为数字而不是. // 只保留第一个. 清除多余的
			      if(checkPlan[0]==0&&checkPlan[1]!='.'){
					  checkPlan = parseFloat(checkPlan) + "";
				  }
					if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
						// 以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
						
					} else if (checkPlan.indexOf(".") >= 0) {
						if (checkPlan.indexOf(".") != checkPlan.lastIndexOf(".")) {
							checkPlan = checkPlan.slice(0, checkPlan.lastIndexOf(".")) +
								checkPlan.slice(checkPlan
									.lastIndexOf(".") + 1, checkPlan.length)
			
						}
					}
					if(checkPlan.lastIndexOf("-") >0){
						checkPlan = checkPlan.slice(0, checkPlan.lastIndexOf("-")) +
							checkPlan.slice(checkPlan
								.lastIndexOf("-") + 1, checkPlan.length)
					}
					
					this.liveData[item] = checkPlan
				}
			
				// if(checkPlan>1){
				// 	checkPlan = checkPlan
				// 		.replace(/^0*/g, "") // 清除数字之前的0
				// }else{
				// 	checkPlan = checkPlan
				// 		.replace(/^0*/g, "0") // 清除数字之前的0
				// }
				//  // if(yy.indexOf('.')!=yy.lastIndexOf('.')){
				//  //  var cc = yy.lastIndexOf('.')
				//  //   yy.splice(cc,1)
				//  //    console.log(cc,yy)
				//  // }
			
			},
			dowload(item) {
				window.open(item)
			}
		}
	};
</script>

<style lang="scss" scoped>
	.weizhi .weizhi .el-dialog__body {
		height: 500px;
	}

	/*.hide {
    .el-cascader-menu:first-of-type {
      .el-cascader-node {
        .el-checkbox {
          display: none;
        }
      }
    }
  }*/

	// .el-cascader-panel > div:first-child .el-checkbox {
	//   display: none;
	// }
</style>